<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/lkzgx365/all-memory">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
    <link rel="stylesheet" th:href="@{/lib/zTree_v3/css/zTreeStyle/zTreeStyle.css}" type="text/css">
</head>
<body>
<div class="layui-form timo-compile">
    <form th:action="@{/business/sell/save}">
        <input type="hidden" name="id" th:if="${sell}" th:value="${sell.id}"/>
        <div class="layui-form-item">
            <label class="layui-form-label required">用户</label>
            <div class="layui-input-inline">
                <select name="accountId" lay-verify="required" lay-filter="college" class="select"
                         placeholder="用户">
                    <option value=""></option>
                    <option th:each="item:${accountList}" th:selected="${item.id == sell?.accountId ? 'selected':''}" th:value="${item.id}" th:text="${item.realName}"></option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">手机号</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="phone" placeholder="手机号" th:value="${sell?.phone}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">型号</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="model" placeholder="型号" th:value="${sell?.model}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">数量</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="count" placeholder="数量" th:value="${sell?.count}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">日期</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="date" name="createDate" placeholder="请输入日期"
                       th:value="${sell ==null }?'':${#dates.format(sell.createDate,'yyyy-MM-dd')}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">价格</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="price" placeholder="价格" th:value="${sell?.price}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">是否已开票</label>
            <div class="layui-input-inline">
                <select name="invoice" lay-verify="required" lay-filter="college" class="select"
                        th:value="${sell?.invoice}" placeholder="是否已开票">
                    <option value=""></option>
                    <option th:selected="${sell?.invoice == 1?true:false}" value="1">已开票</option>
                    <option th:selected="${sell?.invoice == 0?true:false}" value="0">未开票</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item timo-finally">
            <button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
            <button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
        </div>
    </form>
</div>
<script th:replace="/common/template :: script"></script>
<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/zTree_v3/js/jquery.ztree.core.min.js}"></script>
<script type="text/javascript" th:src="@{/js/timoTree.js}"></script>
<script type="text/javascript">
    // 树形菜单
    $.fn.selectTree();

    $("#invoice").attr("checked", "checked");
</script>
</body>
</html>